package au.com.identityconcepts.windowslive.sso._test;

import java.util.Calendar;
import java.text.SimpleDateFormat;

import au.com.identityconcepts.windowslive.sso.ws.*;

public class WindowsLiveHelperSSO {

	private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog("WindowsLiveHelperSSO");	
	public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";	
	private Session session = null;
	public static int iterations = 1;
	
	public static void main(String[] args) {	
		
		System.out.println("WindowsLiveHelperSSO-CodePlex Startup " + now());		

		// Build a Windows Live Session		
		WindowsLiveHelperSSO wlh = new WindowsLiveHelperSSO();
				
		System.out.println("Finished " + now());
	}
	
	public WindowsLiveHelperSSO() {
		try {
			this.session = new Session();			
		} catch (Exception e) 
		{
			System.out.println("Unable to initialize");
			return;
		}

		// GetSLT    		    		
		System.out.println("Calling GetSLT " + now());
		for (int i=0; i < iterations; i++) {			
			System.out.println(now() + " " + this.session.GetSLT(this.session.domainAdmin, 30));			
		}
	}
		
	public static String now() {
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
		return sdf.format(cal.getTime());
	}
}
